<!DOCTYPE html>
<html lang="en">
  <head>
    
<meta charset="UTF-8"/>
<meta http-equiv="X-UA-Compatible" content="IE=edge" />
<meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1"/>


<meta http-equiv="Cache-Control" content="no-transform" />
<meta http-equiv="Cache-Control" content="no-siteapp" />



  <meta name="description" content="CentOS安装配置jdk"/>




  <meta name="keywords" content="linux," />




  <link rel="alternate" href="/atom.xml" title="imIce">




  <link rel="shortcut icon" type="image/x-icon" href="/favicon.ico?v=2.4.x" />



<link rel="canonical" href="http://yoursite.com/2017/09/04/CentOS_jdk1.7/"/>


<meta name="description" content="CentOS：6.9 x64jdk：1.7  查看是否安装有jdk，并删除之前版本1234#查看rpm -qa|grep java#删除rpm -e --nodeps java-XXXX">
<meta name="keywords" content="linux">
<meta property="og:type" content="article">
<meta property="og:title" content="CentOS安装配置jdk">
<meta property="og:url" content="http://yoursite.com/2017/09/04/CentOS_jdk1.7/index.html">
<meta property="og:site_name" content="imIce">
<meta property="og:description" content="CentOS：6.9 x64jdk：1.7  查看是否安装有jdk，并删除之前版本1234#查看rpm -qa|grep java#删除rpm -e --nodeps java-XXXX">
<meta property="og:locale" content="en">
<meta property="og:updated_time" content="2017-09-04T06:49:53.525Z">
<meta name="twitter:card" content="summary">
<meta name="twitter:title" content="CentOS安装配置jdk">
<meta name="twitter:description" content="CentOS：6.9 x64jdk：1.7  查看是否安装有jdk，并删除之前版本1234#查看rpm -qa|grep java#删除rpm -e --nodeps java-XXXX">


<link rel="stylesheet" type="text/css" href="/css/style.css?v=2.4.x" />



  <link rel="stylesheet" type="text/css" href="/lib/fancybox/jquery.fancybox.css" />





<script>
  var CONFIG = {
    search: true,
    searchPath: "/search.xml",
    fancybox: true,
    toc: true,
  }
</script>




  



    <title> CentOS安装配置jdk · imIce </title>
  </head>

  <body><div id="mobile-navbar" class="mobile-navbar">
  <div class="mobile-header-logo">
    <a href="/." class="logo">imIce</a>
  </div>
  <div class="mobile-navbar-icon">
    <span></span>
    <span></span>
    <span></span>
  </div>
</div>

<nav id="mobile-menu" class="mobile-menu slideout-menu">
  <ul class="mobile-menu-list">
    
      <a href="/">
        <li class="mobile-menu-item">
          
          
            Home
          
        </li>
      </a>
    
      <a href="/archives/">
        <li class="mobile-menu-item">
          
          
            Archives
          
        </li>
      </a>
    
      <a href="/tags">
        <li class="mobile-menu-item">
          
          
            Tags
          
        </li>
      </a>
    
      <a href="/about">
        <li class="mobile-menu-item">
          
          
            About
          
        </li>
      </a>
    
  </ul>
</nav>

    <div class="container" id="mobile-panel">
      <header id="header" class="header"><div class="logo-wrapper">
  <a href="/." class="logo">imIce</a>
</div>

<nav class="site-navbar">
  
    <ul id="menu" class="menu">
      
        <li class="menu-item">
          <a class="menu-item-link" href="/">
            
            
              Home
            
          </a>
        </li>
      
        <li class="menu-item">
          <a class="menu-item-link" href="/archives/">
            
            
              Archives
            
          </a>
        </li>
      
        <li class="menu-item">
          <a class="menu-item-link" href="/tags">
            
            
              Tags
            
          </a>
        </li>
      
        <li class="menu-item">
          <a class="menu-item-link" href="/about">
            
            
              About
            
          </a>
        </li>
      
      
        <li class="menu-search">
          <form>
            <i class="iconfont icon-search" id="open-search"></i>
            <input type="text" class="search-input" id="search-input" />
            <i class="iconfont icon-close" id="close-search"></i>
          </form>
        </li>
      
    </ul>
  
</nav>

      </header>

      <main id="main" class="main">
        <div class="content-wrapper">
          <div id="content" class="content">
            
  
  <article class="post">
    <header class="post-header">
      <h1 class="post-title">
        
          CentOS安装配置jdk
        
      </h1>

      <div class="post-meta">
        <span class="post-time">
          Sep 4, 2017
        </span>
      </div>
    </header>

    
    

    <div class="post-content">
      
        <blockquote>
<p>CentOS：6.9 x64<br>jdk：1.7</p>
</blockquote>
<p><strong>查看是否安装有jdk，并删除之前版本</strong><br><figure class="highlight dos"><table><tr><td class="gutter"><pre><div class="line">1</div><div class="line">2</div><div class="line">3</div><div class="line">4</div></pre></td><td class="code"><pre><div class="line">#查看</div><div class="line">rpm -qa|grep java</div><div class="line">#删除</div><div class="line">rpm -e --nodeps java-XXXX</div></pre></td></tr></table></figure></p>
<a id="more"></a>
<p><strong>从官网下载好1.7的安装包，解压到指定目录/usr/local/java</strong><br><figure class="highlight dos"><table><tr><td class="gutter"><pre><div class="line">1</div><div class="line">2</div></pre></td><td class="code"><pre><div class="line">tar zxvf jdk-<span class="number">7</span>u79-linux-x64.tar.gz -C /usr/local/java/</div><div class="line">#当前目录结构为 /usr/local/java/jdk1.<span class="number">7</span>.<span class="number">0</span>_79</div></pre></td></tr></table></figure></p>
<p><strong>配置环境变量，编辑/etc/prodile文件</strong><br><figure class="highlight dos"><table><tr><td class="gutter"><pre><div class="line">1</div><div class="line">2</div><div class="line">3</div><div class="line">4</div><div class="line">5</div></pre></td><td class="code"><pre><div class="line">vim /etc/profile</div><div class="line">#在末尾添加</div><div class="line">export JAVA_HOME=/usr/local/java/jdk1.<span class="number">7</span>.<span class="number">0</span>_79</div><div class="line">export CLASSPATH=.:$JAVA_HOME/jre/lib/rt.jar:$JAVA_HOME/lib/dt.jar:$JAVA_HOME/lib/tools.jar </div><div class="line">export <span class="built_in">PATH</span>=$<span class="built_in">PATH</span>:$JAVA_HOME/bin</div></pre></td></tr></table></figure></p>
<p><strong>重新加载/etc/profile</strong><br><figure class="highlight dos"><table><tr><td class="gutter"><pre><div class="line">1</div></pre></td><td class="code"><pre><div class="line">souce /etc/profile</div></pre></td></tr></table></figure></p>
<p><strong>查看</strong><br><figure class="highlight dos"><table><tr><td class="gutter"><pre><div class="line">1</div><div class="line">2</div><div class="line">3</div><div class="line">4</div><div class="line">5</div></pre></td><td class="code"><pre><div class="line">java -version</div><div class="line">#显示如下</div><div class="line">java version "<span class="number">1</span>.<span class="number">7</span>.<span class="number">0</span>_79"</div><div class="line">Java(TM) SE Runtime Environment (build <span class="number">1</span>.<span class="number">7</span>.<span class="number">0</span>_79-b15)</div><div class="line">Java HotSpot(TM) <span class="number">64</span>-Bit Server VM (build <span class="number">24</span>.<span class="number">79</span>-b02, mixed <span class="built_in">mode</span>)</div></pre></td></tr></table></figure></p>

      
    </div>

    
      
      



      
      
  <div class="post-reward">
    <input type="checkbox" name="reward" id="reward" hidden />
    <label class="reward-button" for="reward">Reward</label>
    <div class="qr-code">
      
      
        <label class="qr-code-image" for="reward">
          <img class="image" src="/image/reward/wechat.png" title="wechat">
        </label>
      
      
        <label class="qr-code-image" for="reward">
          <img class="image" src="/image/reward/alipay.png" title="alipay">
        </label>
      
    </div>
  </div>

    

    
      <footer class="post-footer">
        
          <div class="post-tags">
            
              <a href="/tags/linux/">linux</a>
            
          </div>
        
        
        
  <nav class="post-nav">
    
    
      <a class="next" href="/2017/08/17/slideLoading/">
        <span class="next-text nav-default">手机端页面下滑异步加载数据</span>
        <span class="prev-text nav-mobile">Next</span>
        <i class="iconfont icon-right"></i>
      </a>
    
  </nav>

      </footer>
    

  </article>


          </div>
          
  <div class="comments" id="comments">
    
  </div>


        </div>  
      </main>

      <footer id="footer" class="footer">

  <div class="social-links">
    
      
        
          <a href="mailto:ice105ow@qq.com" class="iconfont icon-email" title="email"></a>
        
      
    
      
    
      
    
      
    
      
    
      
    
      
    
      
    
      
    
      
    
      
    
    
    
      <a href="/atom.xml" class="iconfont icon-rss" title="rss"></a>
    
  </div>


<div class="copyright">
  <span class="power-by">
    Powered by <a class="hexo-link" href="https://hexo.io/">Hexo</a>
  </span>
  
  <span class="theme-info">
    Theme - 
    <a class="theme-link" href="https://github.com/ahonn/hexo-theme-even">Even</a>
  </span>

  <span class="copyright-year">
    
    &copy; 
     
      2016 - 
    
    2017

    <span class="heart">
      <i class="iconfont icon-heart"></i>
    </span>
    <span class="author">ice</span>
  </span>
</div>
      </footer>

      <div class="back-to-top" id="back-to-top">
        <i class="iconfont icon-up"></i>
      </div>
    </div>

    
  



    
  





  
    <script type="text/javascript" src="/lib/jquery/jquery-3.1.1.min.js"></script>
  

  
    <script type="text/javascript" src="/lib/slideout/slideout.js"></script>
  

  
    <script type="text/javascript" src="/lib/fancybox/jquery.fancybox.pack.js"></script>
  


    <script type="text/javascript" src="/js/src/even.js?v=2.4.x"></script>
<script type="text/javascript" src="/js/src/bootstrap.js?v=2.4.x"></script>

    
  <script type="text/html" id="search-result">
    <article class="post">
      <header class="post-header">
        <h1 class="post-title">
          <a href="$url$" class="post-link">
            $title$
          </a>
        </h1>
      </header>
      <div class="post-content">
        $content$
        <div class="read-more">
          <a href="$url$" class="read-more-link">
            Read more..
          </a>
        </div>
      </div>
    </article>
  </script>
  <script type="text/html" id="no-search-result">
    <div class="no-result">
      <h2>No result found!</h2>
    </div>
  </script>
  <script type="text/javascript" src="/js/src/search.js?v=2.4.x"></script>

  </body>
</html>
